package com.tonicartos.superslim;

/**
 * Created by litl on 2016/6/21.
 */
public class SectionHelper extends Object {

    private SectionData mHeader;
    private SectionData mEnder;

    private SectionLayoutManager.SectionDelegate mDelegate;

    public SectionHelper(SectionLayoutManager.SectionDelegate delegate) {
        super();
        mDelegate = delegate;
    }


    public SectionData findSection(int position) {
        // TODO
        SectionData section = findSectionInCache(position);
        if (null == section) {

        }
        return null;
    }

    public SectionData nextSection(int position) {
        // TODO
        return null;
    }

    public SectionData preSection(int position) {
        // TODO
        return null;
    }

    private SectionData findSectionInCache(int position) {
        if (null == mHeader) {
            return null;
        }

        SectionData current = mHeader;
        while (null != current) {
            if (position == mHeader.getPosition()) {
                break;
            }
            current = current.getNext();
        }
        return current;
    }

    public void reset() {
        mHeader = mEnder = null;
    }
}
